package threading;

public class ThreadDemo16 {
    public static void main(String[] args) throws InterruptedException {

        for (int i = 0; i < 20; i++) {
            int number = i;
            Thread thread = new Thread( () -> {
                System.out.println(number);
            } );
            thread.start();
            thread.join();
        }

        System.out.println("ok");
    }
}
